Write-Host "正在启动知识问答系统..." -ForegroundColor Green
Write-Host ""

# 切换到项目目录
$projectPath = Join-Path $PSScriptRoot "src\KnowledgeQA.API"
Set-Location $projectPath

Write-Host "当前目录: $(Get-Location)" -ForegroundColor Yellow
Write-Host ""

# 编译项目
Write-Host "正在编译项目..." -ForegroundColor Cyan
dotnet build
if ($LASTEXITCODE -ne 0) {
    Write-Host "编译失败，请检查错误信息" -ForegroundColor Red
    Read-Host "按回车键退出"
    exit 1
}

Write-Host ""
Write-Host "编译成功，正在启动项目..." -ForegroundColor Green
Write-Host ""
Write-Host "项目启动后，请访问以下地址：" -ForegroundColor Yellow
Write-Host "- API文档: http://localhost:5000/swagger" -ForegroundColor Cyan
Write-Host "- 健康检查: http://localhost:5000/health" -ForegroundColor Cyan
Write-Host ""
Write-Host "按 Ctrl+C 停止项目" -ForegroundColor Red
Write-Host ""

# 启动项目
dotnet run

Read-Host "按回车键退出" 